POV-Ray : Newsgroups : povray.general : evenly spaced points on splines : Re: evenly spaced points on splines Server Time
30 Jul 2024 22:27:49 EDT (-0400)
  Re: evenly spaced points on splines  
From: Warp
Date: 11 Apr 2008 08:44:12
Message: <47ff5d1b@news.povray.org>
stevenvh <nomail@nomail> wrote:
> when I recently started working with (natural) splines I was somewhat
> disappointed to see that the generated points weren't evenly spaced.

  That's a normal property of splines.

  If you calculate points along a spline at evenly-spaced time values,
the distance between these points depend on the geometry of the spline
(the distance between control points and the spline curvature). This is
the fastest way of calculating points along a spline (and in many cases
even the desired thing because it produces smooth and natural-looking
"acceleration" and "deceleration", and other non-linear effects).

  Calculating evenly-spaced points in a spline is a hard problem.
The easiest (although perhaps not the absolute fastest) solution to
it is to approximate by adaptive sampling. This means that the next
point in the spline is searched by first calculating one point at
a "guessed" distance, then refine that "guess" and calculate another
point, and so on, all the time approaching the actual point (which will
never be actually reached, but the end result will be quite close to it).

  POV-Ray doesn't offer internally any such approximation feature. If you
need it, you'll have to create the necessary SDL code yourself.

> Suppose you want to place 100 objects evenly along the spline's path.
> You create an array of 10000 elements, say a few orders of magnitude more than
> the number of points you're interested in. Calculate 10000 points on the
> spline, and the distance from the previous point.

  That's a much slower approach than the adaptive sampling. It also wastes
a lot of memory.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.